//
//  SecondViewCell.m
//  quxiangtao
//
//  Created by HHuajiang on 2018/11/20.
//  Copyright © 2018 shanhaijin. All rights reserved.
//

#import "SecondViewCell.h"
@interface SecondViewCell ()
@property (nonatomic, strong) UILabel *headerTitle;
@property (nonatomic, strong) UILabel *desL;

@end

@implementation SecondViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewScrollPositionNone;
        self.backgroundColor = Colorf2f2f2;

        UIView *viewwwww = [[UIView alloc] init];
        viewwwww.backgroundColor = WhiteColor;
        [self.contentView addSubview:viewwwww];
        [viewwwww mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.mas_equalTo(0);
            make.left.mas_equalTo(Margin);
            make.right.mas_equalTo(-Margin);
        }];
        
        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, WIDTH-2*Margin, jisuan(130)) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)];
        CAShapeLayer *maskLayer = [[CAShapeLayer alloc]init];
        //设置大小
        maskLayer.frame = CGRectMake(0, 0, WIDTH-2*Margin, jisuan(130));
        //设置图形样子
        maskLayer.path = maskPath.CGPath;
        viewwwww.layer.mask = maskLayer;
        
    
        
        
        UIImageView *_rightIV = [[UIImageView alloc] init];
        _rightIV.image = [UIImage imageNamed:@"rightIVbg"];
        _rightIV.contentMode = UIViewContentModeScaleAspectFit;
        
        UIImageView  *_leftIV = [[UIImageView alloc] init];
        _leftIV.image = [UIImage imageNamed:@"leftIVBG"];
        _leftIV.contentMode = UIViewContentModeScaleAspectFit;
        

        
        
        
                [viewwwww addSubview:self.headerTitle];
                [viewwwww addSubview:_leftIV];
                [viewwwww addSubview:_rightIV];
                [viewwwww addSubview:self.desL];
        
        
        
                WS(weakSelf);
                [self.headerTitle mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.centerX.mas_equalTo(weakSelf.mas_centerX);
                    make.top.mas_equalTo(weakSelf.mas_top).with.offset(jisuan(38));
                }];
        
                [_leftIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
                    make.centerY.mas_equalTo(weakSelf.headerTitle.mas_centerY);
                    make.right.mas_equalTo(weakSelf.headerTitle.mas_left).with.offset(-SmallMargin);
                    make.width.mas_equalTo(jisuan(30));
                    make.height.mas_equalTo(jisuan(24));
                }];
                [_rightIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
                    make.centerY.mas_equalTo(weakSelf.headerTitle.mas_centerY);
                    make.left.mas_equalTo(weakSelf.headerTitle.mas_right).with.offset(SmallMargin);
                    make.width.mas_equalTo(jisuan(30));
                    make.height.mas_equalTo(jisuan(24));
                }];
                [self.desL mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.centerX.mas_equalTo(weakSelf.mas_centerX);
                    make.top.equalTo(weakSelf.headerTitle.mas_bottom).offset(5);
                }];

        
    }
    return self;
}



- (UILabel *)headerTitle {
    
    if (!_headerTitle) {
        
        _headerTitle = [[UILabel alloc] init];
        _headerTitle.font = [UIFont fontWithName:@"Helvetica-Bold" size:jisuan(30)];
        _headerTitle.textAlignment = NSTextAlignmentCenter;
        _headerTitle.textColor = Color333333;
        _headerTitle.text = @"自营商品";
    }
    
    return _headerTitle;
}

- (UILabel *)desL {
    
    if (!_desL) {
        _desL = [[UILabel alloc] init];
        _desL.textAlignment = NSTextAlignmentCenter;
        _desL.textColor = Color999999;
        _desL.font = Font(20);
        _desL.text = @"把最好的推荐给你，只有我们最懂你";
        
    }
    
    return _desL;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
